<template>
	<view class="page">
		<view class="bodys">
			<view class="body_cont">
				<view class="body_cont_input">
					<view class="body_cont_input_right">
						对方账户 |
					</view>
					<input class="body_cont_input_left" v-model="number" border="none" clearable
						placeholder="对方账号,一般为手机号"></input>
				</view>
				<view class="text">
					资金将实时到账,请确认在转账
				</view>
			</view>
			<view class="btn btn_css" @click="next">
				下一步
			</view>
			<view class="text_">
				转账功能试行阶段,暂时不支持向支付宝银行卡用户转账
			</view>
			<!-- <view class="body_cont">
				<view class="body_cont_title">
					转账金额
				</view>
				<view class="body_cont_input ">
					<input v-model="money" border="none" clearable placeholder="请输入转账金额"></input>
				</view>
				<view class="text" style="margin-top: -10rpx;">
					当前可用余额{{all_amount}}元，<text style="color: #ff6433;" @click="allMoney">全部提现</text>
				</view>
				<view class="text">
					钱将实时转入对方账户，无法退还
				</view>
				<view class="btn btn_css" @click="btn">
					确认转账
				</view>
			</view> -->
		</view>
		<!-- 支付密码弹窗 -->
		<!-- 	<uni-popup ref="pay_popup" type="bottom" border-radius="10px 10px 0 0">
			<view class="popups">
				<uni-icons type="close" size="30" @click="pay_close(0)"></uni-icons>
				<view class="popups_title" style="margin-top: -30px;color: black;font-size: 25px;">
					请输入支付密码
				</view>
				<view class="popus_body">
					提现
				</view>
				<view class="popus_money justify-content-center">
					<text class="popus_money_right">
						<text style="font-size: 18px;">￥</text>{{money}}
					</text>
				</view>
				<view class="popus_money_thr">
					<input type="password" placeholder="请输入密码" class="password" :maxlength="6" v-model="password">
				</view>
				<view class="btn btn_css" @click="pay_close(1)">
					确定
				</view>
			</view>
		</uni-popup> -->
	</view>
</template>

<script>
	import {
		getTransferAccounts
	} from '../../api/trade/index.js'
	import {
		getSubmit
	} from '../../api/payouts/index.js'
	import {
		getIndex,
		getOneSerivce,
		getInfoUserByPhone
	} from '../../api/index/index.js'
	export default {
		data() {
			return {
				number: '',
				money: '',
				password: '',
				type: '',
				name: '',
				handingfee: '',
				all_amount: '',
				userInfo: {}
			}
		},
		onLoad() {},
		methods: {
			next() {
				var data = {
					phone: this.number
				};
				getInfoUserByPhone(data).then(res => {
					uni.setStorageSync("userInfo", res.data);
					uni.navigateTo({
						url: '/pages/transfer/transfer_2'
					})
				})
			},
			init() {
				getIndex().then(res => {
					this.all_amount = res.data.money;
				})
			},
			// 全部金额
			allMoney() {
				this.money = this.all_amount
			},
			// 确认转账
			btn() {
				this.$refs.pay_popup.open('center')
			},
			pay_close(e) {
				if (e == 0) {
					this.$refs.pay_popup.close('center')
				} else {
					var data = {
						money: this.money,
						tomobile: this.number,
						toname: this.name,
						pwd: this.password
					};
					this.$refs.pay_popup.close('center')
					getTransferAccounts(data).then(res => {
						uni.showToast({
							"icon": "none",
							"title": res.msg
						})
						setTimeout(() => {
							uni.navigateTo({
								url: '/pages/payouts/await'
							})
						}, 1500);
					})
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		height: 100%;

		.bodys {
			padding: 10rpx;
			margin: 15rpx;

			.body_cont {

				.body_cont_title {
					font-size: 22px;
					font-weight: 550;
				}

				.body_cont_input {
					background-color: white;
					border-radius: 15rpx;
					padding: 15rpx;
					margin: 15rpx 0;
					display: flex;

					.body_cont_input_right {
						margin: 0 5rpx;
						color: #b2b2b2;
					}

					.body_cont_input_left {}
				}

				.text {
					color: #b4b4b4;
					font-size: 13px;
				}

			}

			.btn_css {
				margin: 50rpx 0;
			}

			.text_ {
				color: #b4b4b4;
				font-size: 13px;
				margin-top: -30rpx;
				text-align: center;
			}
		}

	}
</style>